package com.lx.pc.restful.quotationtrend;

import java.io.IOException;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.lx.pc.domain.vo.quotationtrend.QuotationtrendVo;
import com.lx.pc.restful.BaseController;
import com.lx.pc.service.quotationtrend.IQuotationtrendService;
import com.lx.pc.utils.OmsPage;

@Controller
@RequestMapping(name = "quotationtrend")
public class QuotationtrendController extends BaseController{

	/**
	 * 行情走势图
	 * @return
	 */
	@Resource(name = "quotationtrendService")
	private IQuotationtrendService quotationtrendService;
	
	/**
	 * 行情评析列表
	 * @return
	 */
	@RequestMapping(value = "/toQuotationtrendList.do")
	public ModelAndView toQuotationtrendList() {
		ModelAndView mv = new ModelAndView("/information/trend_list");
		return mv;
	}
	
	/**
	 * 行情列表
	 * @param v
	 * @param page
	 * @param size
	 * @return
	 * @throws IOException
	 */
	@RequestMapping("/quotationtrend.do")
	@ResponseBody
    public  String quotationtrend(QuotationtrendVo v,Integer page,Integer size) throws IOException {
        Map<String,Object> result = new HashMap<String, Object>();
        
        OmsPage<QuotationtrendVo> pages = quotationtrendService.findByQuotationtrend(v, page, size);
        result.put("quotationtrend", pages);
        return JSON.toJSONString(result);
    }
	
	/**
	 * 详情页
	 * @return
	 */
	@RequestMapping(value = "/toQuotationtrendDetails.do")
	public ModelAndView toQuotationtrendDetails(String id) {
		ModelAndView mv = new ModelAndView("/information/trend_details");
		BigInteger bId = new BigInteger(id); 
		QuotationtrendVo quotationtrend = quotationtrendService.findByQuotationtrendId(bId);
		mv.addObject("quotationtrend",quotationtrend);
		return mv;
	}
}
